home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15900 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: news.sprintlink.net!datalytics!usenet
  2. From: Rob Stewart <stew@datalytics.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Newbie: Character values?
  5. Date: Mon, 08 Apr 1996 15:26:21 -0400
  6. Organization: Datalytics, Inc
  7. Message-ID: <3169685D.22DB@datalytics.com>
  8. References: <4k7ute$oud@freenet-news.carleton.ca> <4k8cor$oca@grimsel.zurich.ibm.com>
  9. NNTP-Posting-Host: 204.62.224.71
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (WinNT; I)
  14.  
  15. Keith Whittingham wrote:
  16. > In <4k7ute$oud@freenet-news.carleton.ca>, am573@FreeNet.Carleton.CA (Jason Olenick) writes:
  17. > >
  18. > >I am trying to see if the user has typed the Insert or Delete key in a
  19. > >program I wrote...but the unsinged char is giving the values of 0 then 82
  20. > >for insert (same as R) and delete is 0 then 83 (same as S).  So what I'm
  21. > >doing then is seeing if the chars value is 0 if it was then see if the
  22. > >next chars value is 82 or 83.  Is there an easier way around this?  Not
  23. > >that this is hard, it just doesn't seem right.
  24. > >
  25. > You're doing the right (simplest) thing.
  26.  
  27. What you're seeing is a zero used as an escape character.  It 
  28. indicates that the next code is that for a special 
  29. character/key.
  30.  
  31. Do note that the codes you're getting are platform/OS specific.  
  32. The only way to make such code portable would be to create a 
  33. library function that handles OS-specific translation into some 
  34. library-specific representation.  You could then write your 
  35. programs to the library function and its character encoding, 
  36. linking with the correct version of the library for the target 
  37. platform.
  38.  
  39. -- 
  40. Robert Stewart        | My opinions are usually my own.
  41. Datalytics, Inc.    | stew@datalytics.com
  42.